﻿@model Retful
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>ES-MAM Login</title>
    <!-- bootstrap - css -->
    <link href="/Content/BJUI/themes/css/bootstrap.min.css" rel="stylesheet">
    <link rel="shortcut icon" type="image/x-icon" href="/Content/images/favicon.ico" media="screen" />
    <!-- jquery -->
    <script src="/Content/BJUI/js/jquery-1.11.3.min.js"></script>
    <script src="/Content/BJUI/js/jquery.cookie.js"></script>
    <style type="text/css">
        * {
            font-family: "Verdana", "Tahoma", "Lucida Grande", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
        }

        body {
            background: url(/Content/images/loginbg_01.jpg) no-repeat center center fixed;
            -webkit-background-size: cover;
            -moz-background-size: cover;
            -o-background-size: cover;
            background-size: cover;
        }

        a:link {
            color: #285e8e;
        }

        .main_box {
            position: absolute;
            top: 50%;
            left: 50%;
            margin-top: -260px;
            margin-left: -300px;
            padding: 30px;
            width: 600px;
            height: 400px;
            background: #FAFAFA;
            background: rgba(255,255,255,0.5);
            border: 1px #DDD solid;
            border-radius: 5px;
            -webkit-box-shadow: 1px 5px 8px #888888;
            -moz-box-shadow: 1px 5px 8px #888888;
            box-shadow: 1px 5px 8px #888888;
        }

        .main_box .setting {
            position: absolute;
            top: 5px;
            right: 10px;
            width: 10px;
            height: 10px;
        }

            .main_box .setting a {
                color: #FF6600;
            }

            .main_box .setting a:hover {
                color: #555;
            }

        .login_logo {
            height: 45px;
            text-align: center;
            font-size: 32px;
            margin-bottom:10px;
        }

            .login_logo img {
                height: 45px;
            }

        .login_msg {
            text-align: center;
            font-size: 16px;
        }

        .login_form {
            padding-top: 5px;
            font-size: 16px;
        }

        .login_box .form-control {
            display: inline-block;
            *display: inline;
            zoom: 1;
            width: auto;
            font-size: 18px;
        }

            .login_box .form-control.x319 {
                width: 319px;
            }

            .login_box .form-control.x164 {
                width: 164px;
            }

        .login_box .form-group {
            margin-bottom: 20px;
        }

            .login_box .form-group label.t {
                width: 120px;
                text-align: right;
                cursor: pointer;
            }

            .login_box .form-group.space {
                padding-top: 15px;
                border-top: 1px #FFF dotted;
            }

            .login_box .form-group img {
                margin-top: 1px;
                height: 32px;
                vertical-align: top;
            }

        .login_box .m {
            cursor: pointer;
        }

        .bottom {
            text-align: center;
            font-size: 12px;
        }
    </style>
    <script type="text/javascript">
        var COOKIE_NAME = '@ESMAM.Web.Core.BaseController.CONST_COOKIE_UNAME';
        $(function () {
            choose_bg();
            //changeCode();
            if ($.cookie(COOKIE_NAME)) {
                $("#j_loginName").val($.cookie(COOKIE_NAME));
                $("#j_password").focus();
                $("#j_remember").attr('checked', true);
            } else {
                $("#j_loginName").focus();
            }
            /*$("#captcha_img").click(function(){
                changeCode();
            });*/
            $("#login_form").submit(function () {
                var issubmit = true;
                var i_index = 0;
                $(this).find('.in').each(function (i) {  //检测为空
                    if ($.trim($(this).val()).length == 0) {
                        $(this).css('border', '1px #ff0000 solid');
                        issubmit = false;
                        if (i_index == 0)
                            i_index = i;
                    }
                });
                if (!issubmit) {
                    $(this).find('.in').eq(i_index).focus();
                    return false;
                }
                if ($("#j_remember").is(":checked")) {
                    $.cookie(COOKIE_NAME, $("#j_loginName").val(), { path: '/', expires: 15 });
                } else {
                    $.cookie(COOKIE_NAME, null, { path: '/' });  //删除cookie
                }
                $("#login_ok").attr("disabled", true).val('login..');
                //     window.location.href = '/Home/Index'; /*注意：生产环境时请删除此行*/
                return true;
            });
        });
        function genTimestamp() {
            var time = new Date();
            return time.getTime();
        }
        function changeCode() {
            $("#captcha_img").attr("src", "/Login/checkcode?t=" + genTimestamp());
        }
        function choose_bg() {
            var bg = padLeft(Math.floor(Math.floor(Math.random() * 10 + 1)), 2);
            console.log(bg);
            $('body').css('background-image', 'url(/Content/images/loginbg_' + bg + '.jpg)');
        }

        //字符串补全
        function padLeft(num, totalWidth) {
            return (Array(totalWidth).join('0') + num).slice(-totalWidth);
        }
    </script>
</head>
<body style="background-repeat:no-repeat; background-size:100% 100%;-moz-background-size:100% 100%;">
    <!--[if lte IE 7]>
    <style type="text/css">
    #errorie {position: fixed; top: 0; z-index: 100000; height: 30px; background: #FCF8E3;}
    #errorie div {width: 900px; margin: 0 auto; line-height: 30px; color: orange; font-size: 14px; text-align: center;}
    #errorie div a {color: #459f79;font-size: 14px;}
    #errorie div a:hover {text-decoration: underline;}
    </style>
    <div id="errorie"><div>You are still using the old IE, please upgrade your browser to IE8 or above. <a target="_blank" href="http://windows.microsoft.com/zh-cn/internet-explorer/ie-8-worldwide-languages">Click to upgrade</a>&nbsp;&nbsp;It is highly recommended that you change your browser：<a href="https://www.google.cn/chrome/" target="_blank">Google Chrome</a></div></div>
    <![endif]-->
    <div class="main_box">
        <div class="setting">
            <a href="javascript:;" onclick="choose_bg();" title="Change background">
                <span class="glyphicon glyphicon-th-large"></span>
            </a>
        </div>
        <div class="login_box">
            <div class="login_logo">&nbsp;&nbsp;&nbsp;ES-MAM System</div>
            @if (Model != null && Model.Code == -1)
            {
                <div class="login_msg">
                    <font color="red">@Model.Msg</font>
                </div>
            }
            <div class="login_form">
                <form action="/Login/Index" id="login_form" method="post" autocomplete="off">
                    <div class="form-group">
                        <label for="j_loginName" class="t"></label>
                        <input id="j_loginName" value="" name="loginName" type="text" class="form-control x319 in" autocomplete="off" aria-label="" placeholder="login name">
                    </div>
                    <div class="form-group">
                        <label for="j_password" class="t"></label>
                        <input id="j_password" value="" name="password" type="password" class="form-control x319 in" placeholder="password" >
                    </div>
                    <div class="form-group">
                        <label for="j_checkcode" class="t"></label>
                        <input id="j_checkcode" name="checkcode" type="text" class="form-control x164 in" placeholder="checkcode" autocomplete="off">
                        <img id="captcha_img" alt="Click Replace" title="Click Replace" src="/Login/checkcode" onclick="changeCode()" class="m">
                    </div>
                    <div class="form-group">
                        <label class="t"></label>
                        <label for="j_remember" class="m"><input id="j_remember" type="checkbox" value="true">&nbsp;Remember login account!</label>
                    </div>
                    <div class="form-group space text-center">
                        <label class="t"></label>
                        <input type="submit" id="login_ok" value="&nbsp;login&nbsp;" class="btn btn-primary btn-lg">&nbsp;&nbsp;
                        <input type="reset" value="&nbsp;reset&nbsp;" class="btn btn-default btn-lg">
                    </div>
                </form>
            </div>
        </div>
        <div class="bottom">
        </div>
    </div>
</body>
</html>